package ExericeOfThread;

class window extends Thread{
    private static int ticket=100;
    public void run(){
        while (true){
            if (ticket>0){
                System.out.println(Thread.currentThread().getName()+"买票，票号:"+ticket);
                ticket--;
            }
        }

    }
}
class ExericeOfThread{
    public static void main(String[] args) {
        window t1 = new window();
        window t2 = new window();
        window t3 = new window();
        t1.setName("窗口一");
        t2.setName("窗口二");
        t3.setName("窗口三");
        t1.start();
        t2.start();
        t3.start();
    }
}